/**
 * Copyright (C)  2011  chen wei hua.
 * Permission is granted to copy, distribute and/or modify this document
 * under the terms of the GNU Free Documentation License, Version 2.0
 * or any later version published by the Free Software Foundation;
 * with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts.
 * A copy of the license is included in the section entitled "GNU Free Documentation License".
 */
package com.javaeye.store.service;

import java.util.List;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

import com.javaeye.store.dao.MaterialsSKUDetailDAO;
import com.javaeye.store.dto.MaterialsSKUDetail;

public class MaterialsSKUDetailService implements IMaterialsSKUDetailService {
	
	protected static Log log = LogFactory.getLog(MaterialsSKUDetailService.class);
	
	private MaterialsSKUDetailDAO dao;
	
	
	public void setDao(MaterialsSKUDetailDAO dao) {
		this.dao = dao;
	}


	/**
	 * 取得在库品的SKU
	 * @param code 在库品SKU ID
	 * @return 
	 */
	public MaterialsSKUDetail getMaterialsSKUDetail(int id) {
		MaterialsSKUDetail detail = dao.getMaterialsSKUDetail(id);
		if (detail == null) {
			log.warn("未找到在库品的SKU信息，id=" + id);
		}
		return detail;
	}
	
	/**
	 * 需要退供应商的在库品
	 * @return
	 */
	public List<MaterialsSKUDetail> getNeedDefectiveMaterials() {
		List<MaterialsSKUDetail> result = dao.getNeedDefectiveMaterials();
		return result;
	}
}
